home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / System / CADAR / Symbols / Other / change-every-n < prev    next >
Lisp/Scheme  |  1998-10-22  |  411b  |  22 lines

  1. change-every-n 
  2. number-list which-positions-to-change-list change
  3.  
  4. changes every position in 
  5. which-positions-to-change-list by change
  6.  
  7. (setq number-list '(1 2 3 4 5 6 7))
  8. ->(1 2 3 4 5 6 7)
  9.  
  10. (setq changed-number-list 
  11. (change-every-n number-list '(2 4 6) 1))
  12. ->(1 3 3 5 5 7 7)
  13.  
  14.  
  15. (setq another-changed-number-list 
  16.       (change-every-n number-list 
  17.                       '(2 4 6) '(2 -1)))
  18. ->(1 4 3 3 5 8 7)
  19.  
  20.  
  21.  
  22.